var connection_c2;
var id_c;
function load_page(url) 
{
  if(url=='')
  {
        return;
  }
  connection_c2=postRequest();
  connection_c2.onreadystatechange = proce;
  connection_c2.open("GET", url, true);
  connection_c2.send(null);
}

function postRequest() 
{
  var xmlHttp=null;
  if (window.XMLHttpRequest) {
	  xmlHttp = new XMLHttpRequest();
  }
  else if (window.ActiveXObject) {
	      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  return xmlHttp;
}

function proce()
{
  if(connection_c2.readyState == 4)
  {
	  update_page(connection_c2.responseText);
  } 
}   
        function update_page(str){
        	loadComments(id_c);
        }
        
        function insert_comment(){
        id_c = document.comment.id.value;
        var comment = document.comment.commentstext.value;
        var url = "upload_comments.php?id=" + id_c + "&comment=" +comment ;
        load_page(url);
        //document.comment.commentstext.value="";
   }
        
        
        function ifEnter(field,event) {
			var theCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
			if (theCode == 13){
				insert_comment();
			return false;
			} 
			else
			return true;
			}